<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block data-th-replace="/adminlte/base::base-head"></th:block>
</head>
<body class="hold-transition sidebar-mini layout-fixed">
<div class="modal fade" id="dialog-member-edit">
   <div class="modal-dialog">
       <div class="modal-content" style="border-radius:5px; margin-top: 10%; border-radius: 5px;">
       	<div class="modal-header">
       		<h4 class="modal-title">修改会员信息</h4>
			<button type="button" class="close" data-dismiss="modal" aria-label="Close">
				<span aria-hidden="true">&times;</span>
			</button>
		</div>
		<form action="/members/infos/" method="put" data-action="info">
			<div class="modal-body">
				<input type="hidden" data-v="select" id="selectId"/>
				<div class="form-group">
					<label><span class="text-red">*</span> 用户昵称</label> <label data-t="nickname" class="form-control" ></label>
				</div>
				<div class="form-group">
					<label><span class="text-red">-</span> 等级经验</label> <input data-v="experience" type="text" class="form-control" name="experience" placeholder="等级经验" autofocus="autofocus">
				</div>
				<div class="form-group">
					<label><span class="text-red">-</span> 请选择VIP</label>
					<select class="selectpicker show-tick form-control" data-live-search="true" name="vipId" data-style="btn-info">
						<option value="0">无VIP会员</option>
				    	<option data-th-each="vip:${memberVipList}" th:utext="${vip.name+'('+vip.level+'级)'}" th:value="${vip.id}"></option>
					</select>
				</div>
				<div class="form-group">
					<label><span class="text-red">-</span> VIP过期时间</label>
					<div class="input-group date">
	                  <div class="input-group-prepend">
	                    <span class="input-group-text"><i class="far fa-clock"></i></span>
	                  </div>
	                  <input type="date" name="expiration" class="form-control float-right" id="datepicker" data-v="expiration">
	                </div>
				</div>
			</div>
			<div class="modal-footer">
				<button class="btn btn-default float-left" data-dismiss="modal" style="width: 100px" type="button">取消</button>
                <button class="btn btn-success float-right" style="width: 100px" type="submit">确定</button>
			</div>
		</form>
        </div>
    </div>
</div>
<div class="wrapper">
<th:block data-th-replace="/adminlte/base::base-navbar"></th:block>
<th:block data-th-replace="/adminlte/base::base-main-sidebar"></th:block>
<div id="body" class="content-wrapper">
	<th:block data-th-replace="/adminlte/base::base-content-header"></th:block>
	<section class="content">
		<div class="container-fluid">
	      <div class="card">
	            <div class="card-header">
	            	<div class="row mt-2">
		              <div class="w-100"></div>
		              <div class="input-group mx-2 mb-2">
		                  <div class="input-group-prepend">
								<button type="submit" class="btn btn-default" data-get-search="#search-member" onclick="changeThis(this)">
								<i class="fas fa-search"></i>
								</button>
							</div>
							<input id="search-member" type="text" name="table_search" class="form-control" placeholder="Search" 
								autofocus="autofocus" data-get-search="#search-member" onkeyup="enterThis(this, changeThis)">
		              </div>
	            	</div>
	            </div>
	            <div class="card-body">
	            	<div class="table-responsive">
		              <table id="member-table" class="table table-bordered table-hover table-striped">
		              	<colgroup>
		              		<col />
		              		<col />
		              		<col />
		              		<col />
		              		<col width="200"/>
		              		<col width="80"/>
		              	</colgroup>
		                <thead>
			                <tr>
								<th>用户昵称</th>
								<th>等级会员</th>
								<th>等级经验</th>
								<th>VIP会员</th>
								<th>VIP过期时间</th>
								<th>操作</th>
			                </tr>
		                </thead>
		                <tbody>
		                	<th:block th:if="${userPage!=null}">
		                		<tr data-th-each="user: ${userPage.data}" th:with="member=${memberUtils.getMember(user.id)}">
									<td>
										<a th:href="${'/admin/user/'+member.userId}" data-th-utext="${user.nickname}"></a>
									</td>
									<td th:with="memberLevel=${memberLevelUtils.getIdNameLevel(member.experience)}">
										<a th:if="${memberLevel!=null}" th:href="${'/admin/member/info?memberLevelId='+memberLevel.id}" data-th-utext="${memberLevel.name+'('+memberLevel.level+'级)'}"></a>
										<a th:unless="${memberLevel!=null}" href="#">无会员等级</a>
									</td>
									<td data-th-utext="${member.experience}">权限名称</td>
									<td th:with="memberVip=${memberVipUtils.getIdNameLevel(member.vipId)}">
										<a th:if="${memberVip!=null}" th:href="${'/admin/member/info?memberVipId='+memberVip.id}" data-th-utext="${memberVip.name+'('+memberVip.level+'级)'}"></a>
									</td>
									<td data-th-utext="${LocalDateUtils.format(member.expiration)}">权限名称</td>
									<td>
										<a title="修改"  data-dialog="show" data-url="#dialog-member-edit" 
										    th:data-dialog-action-info="${member.id}"
											th:data-dialog-v-select="${member.vipId==null?'undefined':member.vipId}" 
											th:data-dialog-v-experience="${member.experience}" 
											th:data-dialog-v-expiration="${member.expiration==null?' ':member.expiration}" 
											th:data-dialog-t-nickname="${userUtils.getNickname(member.userId)}">
											<i class="fas fa-edit text-blue" style="margin-left: 10px;"></i>
										</a>
									</td>
			                	</tr>
		                	</th:block>
		                	<th:block th:if="${userPage==null}">
		                		<tr data-th-each="member: ${memberPage.data}">
			                		<td>
										<input type="checkbox" name="ids" th:value="${member.id}"/>
									</td>
									<td>
										<a th:href="${'/admin/user/'+member.userId}" data-th-utext="${userUtils.getNickname(member.userId)}"></a>
									</td>
									<td th:with="memberLevel=${memberLevelUtils.getIdNameLevel(member.experience)}">
										<a th:if="${memberLevel!=null}" th:href="${'/admin/member/info?memberLevelId='+memberLevel.id}" data-th-utext="${memberLevel.name+'('+memberLevel.level+'级)'}"></a>
										<a th:unless="${memberLevel!=null}" href="#">无会员等级</a>
									</td>
									<td data-th-utext="${member.experience}">权限名称</td>
									<td th:with="memberVip=${memberVipUtils.getIdNameLevel(member.vipId)}">
										<a th:if="${memberVip!=null}" th:href="${'/admin/member/info?memberVipId='+memberVip.id}" data-th-utext="${memberVip.name+'('+memberVip.level+'级)'}"></a>
									</td>
									<td data-th-utext="${LocalDateUtils.format(member.expiration)}">权限名称</td>
									<td>
										<a title="修改" data-dialog="show" data-url="#dialog-member-edit"
										    th:data-dialog-action-info="${member.id}"
											th:data-dialog-v-select="${member.vipId==null?'undefined':member.vipId}" 
											th:data-dialog-v-experience="${member.experience}" 
											th:data-dialog-v-expiration="${member.expiration==null?' ':member.expiration}" 
											th:data-dialog-t-nickname="${userUtils.getNickname(member.userId)}">
											<i class="fas fa-edit text-blue" style="margin-left: 10px;"></i>
										</a>
									</td>
			                	</tr>
		                	</th:block>
		                </tbody>
		              </table>
	            	</div>
	            	<th:block th:if="${userPage!=null}">
	            		<th:block data-th-replace="/adminlte/base::pageNav(${userPage},'个会员')"></th:block>
	            	</th:block>
	            	<th:block th:unless="${userPage!=null}">
	            		<th:block data-th-replace="/adminlte/base::pageNav(${memberPage},'个会员')"></th:block>
	            	</th:block>
	            </div>
	     	</div>
		</div>
	</section>
</div>
<th:block data-th-replace="/adminlte/base::base-footer"></th:block>
<th:block data-th-replace="/adminlte/base::base-control-sidebar"></th:block>
</div>
<script src="/kaibes/js/extend.js"></script>
</body>
</html>